<html>
<head>
<meta name="Generator" content="QQ 80342014" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Keywords" content="<?php echo $this->_var['keywords']; ?>" />
<meta name="Description" content="<?php echo $this->_var['description']; ?>" />

<title><?php echo $this->_var['page_title']; ?></title>

<link rel="shortcut icon" href="favicon.ico" />
<link rel="icon" href="animated_favicon.gif" type="image/gif" />
<link href="<?php echo $this->_var['ecs_css_path']; ?>" rel="stylesheet" type="text/css" />

<?php echo $this->smarty_insert_scripts(array('files'=>'transport_jquery.js,common.js,user.js')); ?>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no" />
<link href="themes/view/css/sheep_details.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php echo $this->fetch('library/header.lbi'); ?>
<?php echo $this->smarty_insert_scripts(array('files'=>'jquery.json.js')); ?>
<?php echo $this->smarty_insert_scripts(array('files'=>'transport_jquery.js')); ?>

<div class="wk-yang">
	<div class="wk-yang-div">
		<div class="wk-yang-img">
			<img src="<?php if ($this->_var['sheep']['logo_img']): ?><?php echo $this->_var['sheep']['logo_img']; ?><?php else: ?>themes/view/images/gz.jpg<?php endif; ?>" />
		</div>
	</div>
	<?php if ($this->_var['sheep']['ym_number'] == $this->_var['sheep']['number'] || $this->_var['sheep']['ym_number'] > $this->_var['sheep']['number']): ?>
	<div class="buylist-mark buylist-mark-timeout" style="width: 75px;height: 75px;background-position: -75px 0;background-size:150px 75px;top:45px;left:210px;"></div>
	<?php else: ?>
		<?php if ($this->_var['sheep']['dq_time'] > $this->_var['sheep']['end_date']): ?>
			<div class="buylist-mark buylist-mark-timeout" style="width: 75px;height: 75px;background-position: 0px 0;background-size:150px 75px;top:45px;left:210px;"></div>
		<?php endif; ?>
	<?php endif; ?>
	<p class="wk-sheep-pz">品种：<?php if ($this->_var['sheep']['sheep_pinzhong']): ?><?php echo $this->_var['sheep']['sheep_pinzhong']; ?><?php else: ?>关中羊<?php endif; ?></p>
	<p class="wk-sheep-name viplevel">第<?php echo $this->_var['sheep']['qishu']; ?>期：<?php echo $this->_var['sheep']['sheep_name']; ?></p>
	<div class="wb-right-box wk-attr">
		<p class="wr-tip">年分红<br/><span><?php echo $this->_var['sheep']['bonus']; ?>%</span><a href="article.php?id=5"><em class="wenhao" style="vertical-align: text-bottom;"></em></a></p>
		<p class="wr-tip">每只/元<br/><span>¥<?php echo $this->_var['sheep']['price']; ?>/只</span></p>
		<p class="wr-tip">期限<br/><span><?php echo $this->_var['sheep']['cycle']; ?>个月</span></p>
		<p class="wr-tip">分红方式<br/><span>按月分红</span></p>
	</div>
</div>














<article class="" style="display: block;" ui-view="" data-current-cache="false">
 <section class="" avalonctrl="buydetails">
    <article class="want-buy-box" style="margin-top:0;border:none">
         <!-- <div class="wb-main">
           <div class="img-box">
                <img src="<?php if ($this->_var['sheep']['logo_img']): ?><?php echo $this->_var['sheep']['logo_img']; ?><?php else: ?>themes/view/images/gz.jpg<?php endif; ?>">
                <p class="img-opac"></p>
                <span class="img-title">品种：<?php if ($this->_var['sheep']['sheep_pinzhong']): ?><?php echo $this->_var['sheep']['sheep_pinzhong']; ?><?php else: ?>关中羊<?php endif; ?></span>
            </div>
            <div class="wb-right-box">
                <p class="wb-right-box-title">第<?php echo $this->_var['sheep']['qishu']; ?>期：<?php echo $this->_var['sheep']['sheep_name']; ?></p>
                <p class="wr-tip">年分红：<span><?php echo $this->_var['sheep']['bonus']; ?>%</span><a href="article.php?id=5"><em class="wenhao"></em></a></p>
                <p class="wr-tip">领养价格：<span>¥<?php echo $this->_var['sheep']['price']; ?>/只</span></p>
                <p class="wr-tip">领养周期：<span><?php echo $this->_var['sheep']['cycle']; ?>个月</span></p>
                <p class="wr-tip">分红方式：按月分红</p>
            </div>
           ms-if-->
		  <!--	<?php if ($this->_var['sheep']['ym_number'] == $this->_var['sheep']['number'] || $this->_var['sheep']['ym_number'] > $this->_var['sheep']['number']): ?>
			<div class="buylist-mark buylist-mark-timeout" style="width: 75px;height: 75px;background-position: -75px 0;background-size:150px 75px;top:60px;left:120px;"></div>
			<?php else: ?>
				<?php if ($this->_var['sheep']['dq_time'] > $this->_var['sheep']['end_date']): ?>
					<div class="buylist-mark buylist-mark-timeout" style="width: 75px;height: 75px;background-position: 0px 0;background-size:150px 75px;top:60px;left:120px;"></div>
				<?php endif; ?>
			<?php endif; ?>
          ms-if
        </div>-->
        <div class="select-num-box">
            <div class="num-leftbox" style="line-height: 52px; ">
                <strong>选择数量</strong> (剩余<?php echo $this->_var['sheep']['sy_number']; ?>只/总数<?php echo $this->_var['sheep']['number']; ?>只) <a href="article.php?id=5"><em class="wenhao" style="    vertical-align: middle"></em></a>
            </div>
            <!-- <div class="num-rightbox">
                <a href="javascript:;" class="num-sub" onclick="del()">-</a>
                <input type="tel" id="number" value="1" readonly class="input">
                <a href="javascript:;" class="num-sub" onclick="add()">+</a>
            </div> -->
        </div>
		<div class="select-num-box">
            <div class="num-leftbox">
                <p class="total-price wk-total-price" ><span>总价：</span><span class="gan-price">¥</span><?php echo $this->_var['sheep']['price']; ?></p>
            </div>
            <div class="num-rightbox">
                <a href="javascript:;" class="num-sub" onclick="del()">-</a>
                <input type="tel" id="number" value="1" readonly class="input">
                <a href="javascript:;" class="num-sub" onclick="add()">+</a>
            </div>
        </div>
       <!--  <p class="total-price" ><span>总价：</span><span class="gan-price">¥</span><?php echo $this->_var['sheep']['price']; ?></p> -->
        <div class="live-mes-box">
            <div class="lmb-btnbox" style="margin-top: 20px;">
                <p>
                    <a class="checkbox check-cur"></a>同意<a href="article.php?id=6">《司令羊服务协议》</a>
                </p>
				<!-- <div style="text-align: center; margin-top: 5px;">102只羊正在付款，如5分钟未完成支付会释放</div> -->
				<!-- <div style="text-align: center; margin-top: 5px;">剩余羊只已锁定,如有释放可再购买</div> -->
				
				<article id="ajax_sheep_details"> </article> 
				
				

            </div>
        </div>
        
        <dl class="infl-nav" style="margin-top:12px; border-top:1px solid #E7E7E7; border-bottom:none;">
            <dd class="w50 cur"><a href="javascript:;">详细购买记录</a></dd>
            <dd class="w50"><a href="javascript:;">本期排行榜</a></dd>
        </dl>
        <div class="paihang1" style="display: block;">
            <ul class="un-infobuylist">
				<?php $_from = $this->_var['xiangxiphb']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'itemphb');$this->_foreach['xiangxiphbs'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['xiangxiphbs']['total'] > 0):
    foreach ($_from AS $this->_var['itemphb']):
        $this->_foreach['xiangxiphbs']['iteration']++;
?>
                <li>
                    <div class="un-ibl-body">
                        <p><strong class="un-ibl-name"><?php if ($this->_var['itemphb']['nickname']): ?><?php echo $this->_var['itemphb']['nickname']; ?><?php else: ?><?php echo $this->_var['itemphb']['mobile_phone']; ?><?php endif; ?></strong>
						<span class="un-ibl-num"><?php echo $this->_var['itemphb']['sheep_number']; ?>只</span></p>
                        <p class="mt"><span class="un-ibl-date"><?php echo $this->_var['itemphb']['add_time']; ?><span><em class="un-ibl-ip"></em></span></span></p>
                    </div>
                    <div class="un-ibl-head"><img width="50" height="50" src="<?php if ($this->_var['itemphb']['touxiang']): ?><?php echo $this->_var['itemphb']['touxiang']; ?><?php else: ?> images/noimg.png<?php endif; ?>"></div>
                </li>
				<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
				
				
            </ul>
            <p id="oneyuanbuying-load" class="J_Loadding loadmore" style="text-align: center;display: block; background-color:#FFF; border-top:1px solid #E7E7E7;">没有更多数据了</p>
        </div>
		
        <div  class="paihang2"style="display: none;">
            <dl class="fee-ph">
				<?php $_from = $this->_var['benqiphb']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'items');$this->_foreach['benqiphbs'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['benqiphbs']['total'] > 0):
    foreach ($_from AS $this->_var['items']):
        $this->_foreach['benqiphbs']['iteration']++;
?>
                <dd>
                    <span class="fee-painum"><em class="fee-ico f-<?php echo $this->_foreach['benqiphbs']['iteration']; ?>"></em></span>
                    <span class="fee-user"><img width="34px" height="34px" src="<?php if ($this->_var['items']['touxiang']): ?><?php echo $this->_var['items']['touxiang']; ?><?php else: ?> images/noimg.png<?php endif; ?>">
					<?php if ($this->_var['items']['nickname']): ?><?php echo $this->_var['items']['nickname']; ?><?php else: ?><?php echo $this->_var['items']['mobile_phone']; ?><?php endif; ?>
					</span>
                    <span class="fee-num"><?php echo $this->_var['items']['sheep_numbers']; ?>只</span>
                </dd>
				<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
     
            </dl>
            
            <p class="loadmore" style="text-align: center;display: block; background-color:#FFF; border-top:1px solid #E7E7E7;">*昵称与头像可在牧羊人里面修改</p>
        </div>
    </article>
</section>
</article>

<script>

 
var id = "<?php echo $this->_var['id']; ?>";



$('.infl-nav dd').click(function(){
	index_div = $(this).index() + 1;
	if(index_div == 1){
		$('.paihang2').hide();
	}else{
		$('.paihang1').hide();
	}
	$('.paihang'+index_div).show();
	$(this).addClass('cur');
	$(this).siblings('dd').removeClass('cur');
});

changePrice();
/**
 *  计算价格
 */
function changePrice()
{
	var qty = document.getElementById("number").value; 
	Ajax.call('sheep.php', 'act=ajaxprice&id=' + id + '&number=' + qty, changePriceResponse, 'GET', 'JSON'); 
}
function changePriceResponse(res){
	if(res.error > 0){
		alert(res.msg);
	}else{
		$('.total-price').html(res.content);
	}
}
/* 购买  */
function add_sheep(id){
	var qty = document.getElementById("number").value; 
	Ajax.call('sheep.php', 'act=ajaxbuy&id=' + id + '&number=' + qty, add_sheepResponse, 'GET', 'JSON'); 
}
function add_sheepResponse(res){
	if(res.error > 0){
		alert(res.msg);
	}else{
		window.location.href="sheep.php?act=buy"; 
	}

}
ajax_sheep_details();
function ajax_sheep_details(){
	Ajax.call('sheep.php', 'act=ajax_sheep_details&id=' + id , Response_ajax_sheep_details, 'GET', 'JSON'); 
}
function Response_ajax_sheep_details(data){
	$('#ajax_sheep_details').html(data.content);
}

</script>
</body>
</html>